﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SiteNavigation_delInclude : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            try
            {
                string ids = Request["ids"].ToString();
                string[] arrID = ids.Split(',');
                CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
                for (int i = 0; i < arrID.Length; i++)
                {
                    int id = int.Parse(arrID[i]);
                    dal.UrlCollect.DeleteObject(dal.UrlCollect.First(x => x.ID == id));
                    dal.SaveChanges();
                }
                ClientScript.RegisterStartupScript(GetType(), "bb", "alert('删除成功');document.location='IncludeLog.aspx';", true);

            }
            catch (Exception ex)
            {
                LogYuMin.LogWriter.GetWriter(LogYuMin.LogFile.error).Write(GetType(), "deleteUrlCollect", LogYuMin.LogStates.ERROR, ex);
                ClientScript.RegisterStartupScript(GetType(), "aa", "alert('删除失败');document.location='IncludeLog.aspx';", true);
            }
        }
    }
}